Ext.define('PJ.view.registrationmanagement.ApplicationNoUserList', {
    extend: 'AM.default.DefaultList',
    selModel: {
    },
    alias: ['widget.ApplicationNoUserList'],
    requires: ['AM.default.DefaultDateField', 
               'AM.default.DateTime', 
               'AM.default.DefaultSearchForm',
               'AM.default.jsonp.DefaultLoadJsonp'//jsonp加载数据
               ],
    
    initComponent: function(){
        var me = this;
        me.columns = [{
        	header: '学员帐号',
        	dataIndex: 'bu.login_id',
        	width: 80
        },{
        	header: '姓名',
        	dataIndex: 'bu.user_Name',
        	width: 80
        }/*, {
            header: '性别',
            dataIndex: 'bu.sex_code',
            width: 50
        },{
            header: '出生年月',
            dataIndex: 'birthdayStr',
            flex:1,
            minWidth: 75,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
	        header: '学时',
			dataIndex: 'c.trainingHours',
			width: 55,
            renderer: function(value, meta, record){
//            	meta.tdAttr = "classUserId='" + record.get("classUserId") + "'";
                return "<span >"+value+"</span>";;
            }
        }, {
            header: '民族',
            dataIndex: 'bu.folk_Code',
            flex:1,
            minWidth: 65,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }*/, {
            header: '单位',
            dataIndex: 'd.depname',
            flex:1,
            minWidth: 140,
            renderer: function(value, meta, record){
            	if(record.get('depParentName')=="组织机构树"||record.get('depParentName')==null||record.get('depParentName')==""){
            		meta.tdAttr = 'data-qtip="' +value+'"';
            	}else{
            		meta.tdAttr = 'data-qtip="' + record.get('depParentName')+"--"+value + '"';
            	}
                return value;
            }
        }/*,{
            header: '职级',
            dataIndex: 'rank',
            flex:1,
            minWidth: 140,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }, {
            header: '单位及职务',
            dataIndex: 'bu.duty_Remark',
            flex:1,
            minWidth: 150,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }*/];
        me.store = Ext.create('PJ.' + prototype + '.registrationmanagement.ApplicationNoUserList', {
        	isLoad: false
        });
        this.plugins = [Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1
        })];
        me.loadType = gj_onlineLearning_constant.loadType;
        me.callParent(arguments);
    },
    /**
     * 同意报名
     */
    onExaminationPassedClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var records=me.getSelectionModel().getSelection();
    	/*for(var i=0;i<records.length;i++){
    		if(records[i].get("c.auditing_State")==1){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '不允许对审核已通过的数据再次进行审核!',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    	};*/
    	var lockState = me.up('window').lockState;
    	if(lockState == 1){
    		Ext.Msg.confirm({
    			title:'提示',
    			msg:'您修改的班级已经锁定，如需继续提交请按确定。',
    			icon:Ext.Msg.WARNING,
    			buttons:Ext.Msg.OKCANCEL,
    			fn:function(id){
    				if(id=='ok'){
    					var courseIds= new Array();
        				var userName = new Array();
        				var auditState = new Array();
        				var userIds = new Array();
        				Ext.Array.each(records,function(name,index){
        					courseIds.push(name.get('classUserId'));
        					userName.push(name.get('bu.user_Name'));
        					auditState.push(name.get('c.auditing_State'));
        					userIds.push(name.get('userId'));
        				});
        				if(gj_onlineLearning_constant.loadType == "jsonp"){
        					var store1 = Ext.create('AM.default.jsonp.DefaultAjaxStore',{
        						loadType: gj_onlineLearning_constant.loadType,
        						url: store.examinationPassedUrl,
        						extraParams: {
        							auditingState: 1,
        							searchClassUserIds:courseIds,
        							auditngNames:userName,
        							auditingStates:auditState,
        							searchUserIds:userIds,
        							searchClassID: me.up('window').classId
        						}
        					});
        					store1.load(function(rec, operation, success){
        						if(success){
        							Ext.Msg.alert('消息', '操作成功！', function(){
        								var store = me.getStore();
        								store.load();
        							});
        						}else{
        							Ext.Msg.alert('消息', operation.error, function(){
        								win.close();
        							});
        						}
        					});
        				}else{
        					Ext.Ajax.request({
        						url:store.examinationPassedUrl,
        						params: {
        							auditingState: 1,
        							searchClassUserIds:courseIds,
        							auditngNames:userName,
        							auditingStates:auditState,
        							searchUserIds:userIds,
        							searchClassID: me.up('window').classId
            					},
        						success:function(response){
        							var data=response.responseText;
        							var json=Ext.decode(data,true);
        							if(json.success){
        								Orchid.alert('提示','操作成功!',function(){
        									store.load();
        								});
        							}else{
        								Orchid.alert('提示',json.msg,function(){
        									store.load();
        								});
        							}
        						}
        					});
        				}
    				}
    			}
    		});
    	}else{
    		var courseIds= new Array();
			var userName = new Array();
			var auditState = new Array();
			var userIds = new Array();
			Ext.Array.each(records,function(name,index){
				courseIds.push(name.get('classUserId'));
				userName.push(name.get('bu.user_Name'));
				auditState.push(name.get('c.auditing_State'));
				userIds.push(name.get('userId'));
			});
			if(gj_onlineLearning_constant.loadType == "jsonp"){
				var store1 = Ext.create('AM.default.jsonp.DefaultAjaxStore',{
					loadType: gj_onlineLearning_constant.loadType,
					url: store.examinationPassedUrl,
					extraParams: {
						auditingState: 1,
						searchClassUserIds:courseIds,
						auditngNames:userName,
						auditingStates:auditState,
						searchUserIds:userIds,
						searchClassID: me.up('window').classId
					}
				});
				store1.load(function(rec, operation, success){
					if(success){
						Ext.Msg.alert('消息', '操作成功！', function(){
							var store = me.getStore();
							store.load();
						});
					}else{
						Ext.Msg.alert('消息', operation.error, function(){
							win.close();
						});
					}
				});
			}else{
				Ext.Ajax.request({
					url:store.examinationPassedUrl,
					params: {
						auditingState: 1,
						searchClassUserIds:courseIds,
						auditngNames:userName,
						auditingStates:auditState,
						searchUserIds:userIds,
						searchClassID: me.up('window').classId
					},
					success:function(response){
						var data=response.responseText;
						var json=Ext.decode(data,true);
						if(json.success){
							Orchid.alert('提示','操作成功!',function(){
								store.load();
							});
						}else{
							Orchid.alert('提示',json.msg,function(){
								store.load();
							});
						}
					}
				});
			}
    	}
    	
    },
    
    /**
     * 确认学员
     */
    onLockStateClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var records=me.getSelectionModel().getSelection();
    	/*for(var i=0;i<records.length;i++){
    		if(records[i].get("c.lockState")==1){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '学员已确认!',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    	};*/
    	Ext.Msg.confirm({
    		title:'提示',
    		msg:'是否确认这些学员？',
    		icon:Ext.Msg.WARNING,
    		buttons:Ext.Msg.OKCANCEL,
    		fn:function(id){
    			if(id=='ok'){
    				var courseIds= new Array();
    				var userIds = new Array();
    				Ext.Array.each(records,function(name,index){
    					courseIds.push(name.get('classUserId'));
    					userIds.push(name.get('userId'));
    				});
    				if(gj_onlineLearning_constant.loadType == "jsonp"){
    					var store1 = Ext.create('AM.default.jsonp.DefaultAjaxStore',{
    						loadType: gj_onlineLearning_constant.loadType,
    						url: store.updateUserLockStateUrl,
    						extraParams: {
    							lockState: 1,
    							searchClassUserIds:courseIds,
    							searchUserIds:userIds
    						}
    					});
    					store1.load(function(rec, operation, success){
    						if(success){
    							Ext.Msg.alert('消息', '操作成功！', function(){
    								var store = me.getStore();
    								store.load();
    							});
    						}else{
    							Ext.Msg.alert('消息', operation.error, function(){
    								win.close();
    							});
    						}
    					});
    				}else{
    					Ext.Ajax.request({
    						url:store.updateUserLockStateUrl,
    						params: {
    							lockState: 1,
    							searchClassUserIds:courseIds,
    							searchUserIds:userIds
        					},
    						success:function(response){
    							var data=response.responseText;
    							var json=Ext.decode(data,true);
    							if(json.success){
    								Orchid.alert('提示','操作成功!',function(){
    									store.load();
    								});
    							}else{
    								Orchid.alert('提示',json.msg,function(){
    									store.load();
    								});
    							}
    						}
    					});
    				}
    			}
    		}
    	});
    },
    /**
     * 不确认学员
     */
    noOnLockStateClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var classUserIds = new Array;
    	var userName = new Array();
    	var auditState = new Array();
    	var userIds = new Array();
    	var records=me.getSelectionModel().getSelection();
    	
    	for(var i=0;i<records.length;i++){
    		classUserIds.push(records[i].get('classUserId'));
    		userName.push(records[i].get('bu.user_Name'));
    		auditState.push(records[i].get('c.auditing_State'));
    		userIds.push(records[i].get('userId'));
    	}
    	Ext.create('PJ.view.trainingmanagement.DoubtfulCheckEdit',{
    		title: "原因",
    		flag:1,
    		grid: me,
    		//commentUrl: store.commentUrl,
    		lockState:2,
    		classUserIds:classUserIds,
    		userName:userName,
    		auditingStates:auditState,
    		searchUserIds:userIds,
    		searchClassID: me.up('window').classId,
    		isReadOnly: false
    	});
    	/*Ext.Msg.confirm({
    		title:'提示',
    		msg:'是否不确认这些学员？',
    		icon:Ext.Msg.WARNING,
    		buttons:Ext.Msg.OKCANCEL,
    		fn:function(id){
    			if(id=='ok'){
    				var courseIds= new Array();
    				var userIds = new Array();
    				Ext.Array.each(records,function(name,index){
    					courseIds.push(name.get('classUserId'));
    					userIds.push(name.get('userId'));
    				});
    				if(gj_onlineLearning_constant.loadType == "jsonp"){
    					var store1 = Ext.create('AM.default.jsonp.DefaultAjaxStore',{
    						loadType: gj_onlineLearning_constant.loadType,
    						url: store.updateUserLockStateUrl,
    						extraParams: {
    							lockState: 2,
    							searchClassUserIds:courseIds,
    							searchUserIds:userIds
    						}
    					});
    					store1.load(function(rec, operation, success){
    						if(success){
    							Ext.Msg.alert('消息', '操作成功！', function(){
    								var store = me.getStore();
    								store.load();
    							});
    						}else{
    							Ext.Msg.alert('消息', operation.error, function(){
    								win.close();
    							});
    						}
    					});
    				}else{
    					Ext.Ajax.request({
    						url:store.updateUserLockStateUrl,
    						params: {
    							lockState: 2,
    							searchClassUserIds:courseIds,
    							searchUserIds:userIds
        					},
    						success:function(response){
    							var data=response.responseText;
    							var json=Ext.decode(data,true);
    							if(json.success){
    								Orchid.alert('提示','操作成功!',function(){
    									store.load();
    								});
    							}else{
    								Orchid.alert('提示',json.msg,function(){
    									store.load();
    								});
    							}
    						}
    					});
    				}
    			}
    		}
    	});*/
    },
    /**
     * 存疑
     */
    doubtfulLockStateClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var classUserIds = new Array;
    	var userName = new Array();
    	var auditState = new Array();
    	var userIds = new Array();
    	var records=me.getSelectionModel().getSelection();
    	/*for(var i=0;i<records.length;i++){
    		if(records[i].get("c.auditing_State")==2){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '不能对报名未通过的数据再次进行驳回!',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    		if(records[i].get("c.auditing_State")==4){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '请先处理撤销审核!',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    		if(records[i].get("c.lockState")==1){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '不允许对已锁定的数据再次进行操作!',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    	};*/
    	for(var i=0;i<records.length;i++){
    		classUserIds.push(records[i].get('classUserId'));
    		userName.push(records[i].get('bu.user_Name'));
    		auditState.push(records[i].get('c.auditing_State'));
    		userIds.push(records[i].get('userId'));
    	}
    	Ext.create('PJ.view.trainingmanagement.DoubtfulCheckEdit',{
    		title: "原因",
    		flag:1,
    		grid: me,
    		//commentUrl: store.commentUrl,
    		lockState:3,
    		classUserIds:classUserIds,
    		userName:userName,
    		auditingStates:auditState,
    		searchUserIds:userIds,
    		searchClassID: me.up('window').classId,
    		isReadOnly: false
    	});
    },
  //撤销报名
    onUnSignUpClick: function(button){
        var me = this;
        var records = this.getSelectionModel().getSelection();
        var flag=true;
        Ext.Array.each(records, function(name, index){

        	if((name.get("c.auditing_State")==1) || (name.get("c.lockState")==1)){
        		Orchid.alert('消息', '合格的学员不允许删除！');
        		flag=false;
        		return;
        	}

        });
        if(flag){
        	Ext.Msg.confirm({
        		title: '提示',
        		msg: '您确定要将这些学员删除吗？',
        		buttons: Ext.Msg.OKCANCEL,
        		fn: function(id){
        			if (id == 'ok') {
        				var classUserIds = new Array();
        				var userIds = new Array();
        				
        				Ext.Array.each(records, function(name, index){
        					classUserIds.push(name.get("classUserId"));
        					userIds.push(name.get("userId"));
        				});
        				Ext.Ajax.request({
        					url: me.getStore().unSignUpUrl,
        					params: {
        						searchClassUserIds: classUserIds,
        						searchUserIds: userIds,
        						auditingState:me.auditingState,
        						clickSource:me.clickSource,
        						openState: me.up('window').openState,
        						searchClassID: me.up('window').classId
        					},
        					success: function(response){
        						var data = response.responseText;
        						var json = Ext.decode(data, true);
        						var msg = json.success == true ? '操作成功！' : json.msg;
        						Orchid.alert('消息', msg, function(){
        							var store = me.getStore();
        							store.load();
        							//me.quotaOfPeople();//预授人数统计
        						});
        						
        						//刷新已选列表
        						var gridList = me.up("container").down("ApplicationAuditList");
        						var gridListStore = gridList.getStore();
        						gridListStore.reload();
        					}
        				});
        			}else {
        				return;
        			}
        		}
        	});
        }
    },
    //报名
    onSignupClick: function(){
       var me = this;
    	
       var win = Ext.create('PJ.view.unitregistrationmanagement.SignUpFrame', {
			grid: me,
			title: "补录学员",
			width: 1200,
			height: 650,
			classId: me.up('window').classId,
			/*openState: records[0].get("t.openState"),
			publishState: records[0].get("t.publishState"),*/
			signUpState:1,
			auditingState:3,
			clickSource:5
		}).show();
		var actionName = "load";
        if(gj_onlineLearning_constant.loadType=="jsonp") {
        	actionName= "loadJsonp";
        }
        /*win.down('form').getForm().doAction(actionName,{
        	url: me.store.configurationUrl,
            params: {
            	classId: me.up('window').classId//培训班ID
            },
            success:function(form,action){
            	var data = action.response.responseText;
    			var json = gj_onlineLearning_constant.loadType=="ajax" ? Ext.decode(data, true) : action.response;
    			var dateStar = json.data.beginDateStr;//举办时间（开始）
    			var dateEnd = json.data.endDateStr;//举办时间（截止）
    			var form = win.down('form');	 
    			var baseForm = form.getForm();
    			baseForm.findField("className").setValue(json.data.className);//班级名称
    			baseForm.findField("learnTime").setValue(dateStar + ' 至 ' + dateEnd);
            }
        });*/
    },
    /**
     * 审核驳回
     */
    onAuditDismissedClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var classUserIds = new Array;
    	var userName = new Array();
    	var auditState = new Array();
    	var userIds = new Array();
    	var records=me.getSelectionModel().getSelection();
    	/*for(var i=0;i<records.length;i++){
    		if(records[i].get("c.auditing_State")==2){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '不能对报名未通过的数据再次进行驳回!',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    		
    	};*/
    	for(var i=0;i<records.length;i++){
    		classUserIds.push(records[i].get('classUserId'));
    		userName.push(records[i].get('bu.user_Name'));
    		auditState.push(records[i].get('c.auditing_State'));
    		userIds.push(records[i].get('userId'));
    	}
    	var lockState = me.up('window').lockState;
    	if(lockState == 1){
    		Ext.Msg.confirm({
    			title:'提示',
    			msg:'您修改的班级已经锁定，如需继续提交请按确定。',
    			icon:Ext.Msg.WARNING,
    			buttons:Ext.Msg.OKCANCEL,
    			fn:function(id){
    				if(id=='ok'){
				    	Ext.create('PJ.view.trainingmanagement.CheckEdit',{
				    		title: "驳回原因",
				    		flag:1,
				    		grid: me,
				    		//commentUrl: store.commentUrl,
				    		classUserIds:classUserIds,
				    		userName:userName,
				    		auditingStates:auditState,
				    		searchUserIds:userIds,
				    		searchClassID: me.up('window').classId,
				    		isReadOnly: false
				    	});
    				}
    			}
    		});
    	}else{
    		Ext.create('PJ.view.trainingmanagement.CheckEdit',{
	    		title: "驳回原因",
	    		flag:1,
	    		grid: me,
	    		//commentUrl: store.commentUrl,
	    		classUserIds:classUserIds,
	    		userName:userName,
	    		auditingStates:auditState,
	    		searchUserIds:userIds,
	    		searchClassID: me.up('window').classId,
	    		isReadOnly: false
	    	});
    	}
    },
    /**
     * 同意撤销申请
     */
    onAgreedToWithdrawClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var records=me.getSelectionModel().getSelection();
    	for(var i=0;i<records.length;i++){
    		if(records[i].get("c.auditing_State")!=4){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '只允许对状态为撤销待审核的人员执行此操作！',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    	};
    	Ext.Msg.confirm({
    		title:'提示',
    		msg:'您确定要同意这些数据的撤销申请操作吗?',
    		icon:Ext.Msg.WARNING,
    		buttons:Ext.Msg.OKCANCEL,
    		fn:function(id){
    			if(id=='ok'){
    				var courseIds= new Array();
    				var searchUserIds = new Array();
    				var userName = new Array();
    				Ext.Array.each(records,function(name,index){
    					courseIds.push(name.get('classUserId'));
    					searchUserIds.push(name.get('userId'));
    					userName.push(name.get('bu.user_Name'));
    				});
    				if(gj_onlineLearning_constant.loadType == "jsonp"){
    					var store1 = Ext.create('AM.default.jsonp.DefaultAjaxStore',{
    						loadType: gj_onlineLearning_constant.loadType,
    						url: store.agreedWithdrawUrl,
    						extraParams: {
    							searchClassUserIds:courseIds,
    							searchUserIds: searchUserIds,
    							openState: me.up('window').openState,
    							auditngNames:userName
    						}
    					});
    					store1.load(function(rec, operation, success){
    						if(success){
    							Ext.Msg.alert('消息', '操作成功！', function(){
    								var store = me.getStore();
    								store.load();
//    								me.quotaOfPeople();//人数统计
    							});
    						}else{
    							Ext.Msg.alert('消息', operation.error, function(){
    								win.close();
    							});
    						}
    					});
    				}else{
    					Ext.Ajax.request({
    						url:store.agreedWithdrawUrl,
    						params: {
    							searchClassUserIds:courseIds,
    							searchUserIds: searchUserIds,
    							openState: me.up('window').openState,
    							clickSource:1,
    							auditngNames:userName
        					},
    						success:function(response){
    							var data=response.responseText;
    							var json=Ext.decode(data,true);
    							if(json.success){
    								Orchid.alert('提示','操作成功!',function(){
    									store.load();
//    									me.quotaOfPeople();//人数统计
    								});
    							}else{
    								Orchid.alert('提示',json.msg,function(){
    									store.load();
    								});
    							}
    						}
    					});
    				}
    			}
    		}
    	});
    },
    /**
     * 驳回撤销申请
     */
    onRejectedRevocationClick: function(){
    	var me=this;
    	var store=me.getStore();
    	var classUserIds = new Array;
    	var userName = new Array;
    	var records=me.getSelectionModel().getSelection();
    	for(var i=0;i<records.length;i++){
    		if(records[i].get("c.auditing_State")!=4){
    			Ext.Msg.show({
    				title: '提示',
    				msg  : '只允许对状态为撤销待审核的人员执行此操作！',
    				icon :Ext.Msg.WARNING,
    				buttons:Ext.Msg.OK
    			});
    			return;
    		}
    	};
    	for(var i=0;i<records.length;i++){
    		classUserIds.push(records[i].get('userId'));
    		userName.push(records[i].get('bu.user_Name'));
    	}
    	Ext.create('PJ.view.registrationmanagement.CheckEdit',{
    		title: "驳回撤销申请原因",
    		flag:1,
    		grid: me,
    		commentUrl: store.rejectedRevocationUrl,
    		classUserIds:classUserIds,
    		userName:userName,
    		isReadOnly: false
    	});
    },
    //名额统计
    quotaOfPeople: function(){
    	var me = this;
        var quotaOfPeopleLabel = this.down("#quotaOfPeople");
        var classNameStr = me.classType;
        if (quotaOfPeopleLabel) {
            if(gj_onlineLearning_constant.loadType == "jsonp"){
            	var store1 = Ext.create('AM.default.jsonp.DefaultAjaxStore',{
            		loadType: gj_onlineLearning_constant.loadType,
            		url: this.store.quotaOfPeopleUrl + '?searchClassID=' + this.up('window').classId
            	});
            	store1.load(function(rec, operation, success){
            		if(success){
            			var jsonData = operation.response.result;
            			quotaOfPeopleLabel.setText(
            					'本班名额<span style="color:red">' + jsonData.asignCount +
            					'</span>人，已报<span style="color:red">' + jsonData.reportedNum +
            					'</span>人，剩余<span style="color:red">' + jsonData.surplusCount +
            					'</span>人。', false);
            		}
            	});
            }else if(gj_onlineLearning_constant.loadType == "ajax"){
            	Ext.Ajax.request({
            		url: this.store.quotaOfPeopleUrl + '?searchClassId=' + this.up('window').classId,
            		success: function(response){
            			var data = response.responseText;
            			var json = Ext.decode(data, true);
            			if (json.success) {
            				var jsonData = json.result;
            				quotaOfPeopleLabel.setText(
            						'本班名额<span style="color:red">' + jsonData.asignCount +
                					'</span>人，已报<span style="color:red">' + jsonData.reportedNum +
                					'</span>人，剩余<span style="color:red">' + jsonData.surplusCount + 
                					'</span>人。', false);
            			}
            		}
            	});
            }
        }
    },
    //导出
    onExportClick: function(){
    	var me = this;
        var store = me.getStore();
        var params=store.proxy.extraParams;
        var href=store.exportUrl + "?";
        for(var param in params){
        	if(params[param] === undefined){
        		href+="&"+param+"=";
        	}else{
        		href+="&"+param+"="+params[param];
        	}
        }
    	href+="&searchSignUpState=1&searchSignUpState=5";
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
    },
    listeners: {
        //点击列表数据时显示按钮事件
    	selectionchange: function(selModel, selected){
    		/*this.down('#' + this.oldId + "ExaminationPassed").setDisabled(selected.length === 0);//审核通过
    		this.down('#' + this.oldId + "AuditDismissed").setDisabled(selected.length === 0);//审核驳回
*///    		this.down('#' + this.oldId + "UnSignUp").setDisabled(selected.length === 0);
//    		this.down('#' + this.oldId + "CombOut").setDisabled(selected.length === 0);//确认
//    		this.down('#' + this.oldId + "CombNoOut").setDisabled(selected.length === 0);
//    		this.down('#' + this.oldId + "doubtfulOut").setDisabled(selected.length === 0);
//    		this.down('#' + this.oldId + "Signup").setDisabled(selected.length === 0);//报名
//    		this.down('#' + this.oldId + "AgreedToWithdraw").setDisabled(selected.length === 0);//同意撤销申请
//    		this.down('#' + this.oldId + "RejectedRevocation").setDisabled(selected.length === 0);//驳回撤销申请
    	},
        viewready: function(){
        	var me = this;
            this.addDocked([{
                dock: 'top',
                xtype: "searchform",
                columnCount: 3,
                fieldDefaults: {
                    xtype: "combo",
                    emptyText: "请选择",
                    editable: false,
                    queryMode: 'local',//'remote',//数据类型
                    valueField: 'value',
                    displayField: 'text',
                    
                    labelAlign: 'right',
                    labelWidth: 100,
                    maxLength: 100
                },
                items: [{
                    xtype: "textfield",
                    fieldLabel: '学员账号',
                    name: "searchLoginID",
                    emptyText: "请输入学员帐号",
                    columnWidth:.5
                },{
                    xtype: "textfield",
                    fieldLabel: '姓名',
                    name: "searchUserName",
                    emptyText: "请输入姓名",
                    columnWidth:.5
                }, {
                    xtype: "textfield",
                    fieldLabel: "单位",
                    name: "searchDepName",
                    emptyText: "请输入单位",
                    columnWidth:1
                }/*, {
                    fieldLabel: "考核状态",
                    name: "searchSignUpState",
                    labelWidth: 80,
                    store: Ext.create("Ext.data.ArrayStore", {
    					fields: ['value', 'text'],
    					data: [[3, '未参训'], [1, '合格'], [2, '不合格'],[4,'待考核'],[5,'报名通过（撤销未通过）']]
    				}),
                    columnWidth:.25
                },{
                    fieldLabel: "确认状态",
                    name: "searchLockState",
                    store: Ext.create("Ext.data.ArrayStore", {
    					fields: ['value', 'text'],
    					data: [[0, '待确认'], [1, '已确认'], [2, '存疑']]
    				}),
                    columnWidth:.25
                }*/],
    			onResetClick: function(button){
                    var form = button.up('form');
                    var gridPanel = form.grid;
                    var newParams = {
                    		searchClassID:me.up('window').classId,
                			clickSource:me.up('window').clickSource,
                    };
                    gridPanel.getStore().proxy.extraParams = {};
                    var params = gridPanel.getStore().proxy.extraParams;
                    Ext.apply(params, newParams);
                    form.getForm().reset();
                },
    			onSelectClick : function(btn) {
    				var form = this;
    				if (form.grid) {
    					if (!form.getForm().isValid()) {
    						return;
    					}
    					var newParams = form.getValues();
    					var store = form.grid.getStore();
    					// 重置翻页属性
    					form.grid.resetPage();
    					// 4.0强制更改store参数写法
    					var params = store.proxy.extraParams;
    					Ext.apply(params, newParams);
    					store.load({
    						scope: form,
    						callback: function(records, operation, success){
    							if(success){
    								this.onAfterSearch(form);
//    								me.quotaOfPeople();//人数统计
    							}
    						}
    					});
    				} else {
    					Ext.Msg.show({
    								title : orchid_lang.promptWindowInfo.warningTitle,
    								msg : default_lang.defaultList.selectWarningMsg,
    								icon : Ext.Msg.WARNING,
    								buttons : Ext.Msg.OK
    							});
    				}
    			},
                grid: this
            },{
                xtype: 'toolbar',
                dock: 'top',
                displayInfo: true,
                items: [/*{
                    text: '补录学员',
                    iconCls: 'signupIco',
                    itemId: this.oldId + "Signup",
                    disabled: false,
                    scope: this,
                    handler: this.onSignupClick
                },'-',{
                    text: '<b><span style="font-size:14px;">删除学员</span></b>',
                    iconCls: 'publishCancelIco',
                    itemId: this.oldId + "UnSignUp",
                    disabled: true,
                    scope: this,
                    handler: this.onUnSignUpClick
                },'-',*//*{
                    text: '合格',
                    iconCls: 'examinationPassedIco',
                    itemId: this.oldId + "ExaminationPassed",
                    disabled: true,
                    scope: this,
                    handler: this.onExaminationPassedClick
                }, '-', {
                    text: '不合格',
                    iconCls: 'auditDismissedIco',
                    itemId: this.oldId + "AuditDismissed",
                    disabled: true,
                    scope: this,
                    handler: this.onAuditDismissedClick
                }, '-',*/ /*{
                    text: '确认',
                    iconCls: 'examinationPassedIco',
                    itemId: this.oldId + "CombOut",
                    disabled: true,
                    scope: this,
                    handler: this.onLockStateClick     
                },'-', {
                    text: '存疑',
                    iconCls: 'auditDismissedIco',
                    itemId: this.oldId + "CombNoOut",
                    disabled: true,
                    scope: this,
                    handler: this.noOnLockStateClick     
                },*//*'-', {
                    text: '存疑',
                    iconCls: 'combOutIco',
                    itemId: this.oldId + "doubtfulOut",
                    disabled: true,
                    scope: this,
                    handler: this.doubtfulLockStateClick     
                }, '-',{
                    text: '同意撤销申请',
                    iconCls: 'examinationPassedIco',
                    itemId: this.oldId + "AgreedToWithdraw",
                    disabled: true,
                    scope: this,
                    handler: this.onAgreedToWithdrawClick
                }, '-', {
                    text: '驳回撤销申请',
                    iconCls: 'auditDismissedIco',
                    itemId: this.oldId + "RejectedRevocation",
                    disabled: true,
                    scope: this,
                    handler: this.onRejectedRevocationClick
                },*//*'-', {
                    text: '导出',
                    iconCls: 'deriveIco',
                    itemId: this.oldId + "Export",
                    disabled: false,
                    scope: this,
                    handler: this.onExportClick
                } ,"-", {
                    xtype: 'label',
                    itemId: 'quotaOfPeople',
                    html: ''
                },*/ "->", "->", this.countSelectPanel]
            }]);
            // 触发权限过滤事件
            this.fireEvent("permission", this);
            var store = this.store;
            var params = store.proxy.extraParams;
            var newParams = {
            		searchClassID:me.up('window').classId,
        			clickSource:me.up('window').clickSource,
        			noClassUserNum:1
            };
            Ext.apply(params, newParams);
            store.isLoad = true;
            store.load(function(rec, operation, success){
//            	me.quotaOfPeople();//人数统计
            });
        },
        afterrender: function(){
            this.loadMask = new Ext.LoadMask(this, {
                msg: "正在加载中,请稍后...."
            });
        }
    }
});
